@echo off
setlocal enabledelayedexpansion
chcp 65001 > nul

set /p PORT_TO_KILL=输入端口号: 

for /f "tokens=5" %%a in ('netstat -ano ^| find ":%PORT_TO_KILL%"') do (
    set "PID=%%a"
    taskkill /F /PID !PID!
)

echo Process on port %PORT_TO_KILL% terminated.
